// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import "./elementui/index"
import Clipboard from 'v-clipboard'
// import Viewer from 'v-viewer'
import store from './store'
import api from "./request/api.js"
Vue.config.productionTip = false
Vue.prototype.$api = api;
Vue.use(Clipboard)
// Vue.use(Viewer,{name: 'viewer'});
/* eslint-disable no-new */

router.beforeEach((to, from, next) =>{
    console.log(from.name);
    if(to.name=="Login"){
        // location.reload()
        next()
        return
    }
    
    var name = sessionStorage.getItem('name');
    console.log(name);
    if(name=="已登陆"){
        next()
        
    }else{
        next({path:"/"})
    }
    console.log(name);
})



new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
